package identity

import (
	"github.com/kataras/iris"
	"superstar/bootstrap"
	"time"
)

func New(b *bootstrap.Bootstrapper)  iris.Handler{
	return func(ctx iris.Context) {
		ctx.Header("App-Name", b.AppName)
		ctx.Header("App-Ower", b.AppOwner)
		ctx.Header("App-Since", time.Since(b.AppSpawnDate).String())
		ctx.Header("Server", "Iris: https://iris-go.com")


		ctx.View("AppName", b.AppName)
		ctx.View("AppOwer", b.AppOwner)
		ctx.Next()
	}
}

// Configure creates a new identity middleware and registers that to the app.
func Configure(b *bootstrap.Bootstrapper) {
	h := New(b)
	b.UseGlobal(h)
}